package com.tech.cloud.controller;

import cn.hutool.core.date.DateUtil;
import com.tech.cloud.apis.PayFeignApi;
import com.tech.cloud.dto.PayDTO;
import com.tech.cloud.po.OrderPO;
import com.tech.cloud.resp.ResultData;
import com.tech.cloud.resp.ReturnCodeEnum;
import com.tech.cloud.service.OrderService;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class OrderController {

    @Autowired
    private PayFeignApi payFeignApi;


    @Resource
    private OrderService orderService;

    @GetMapping(value = "/order/get/{id}")
    public ResultData getPayInfo(@PathVariable("id") Integer id) {
        System.out.println("-------支付微服务远程调用，按照id查询订单支付流水信息");
        ResultData resultData = payFeignApi.getPayInfo(id);
        return resultData;
    }

    /**
     * 创建订单
     */
    @GetMapping("/order/create")
    public ResultData create(OrderPO order)
    {
        orderService.create(order);
        return ResultData.success(order);
    }

}
